<template>
    
    <el-container class="layout-container-demo" style="height: 500px">
      <el-aside width="200px">
        <el-scrollbar>
          <el-menu @select="handleSelect">
            <el-menu-item index="1">
                <el-icon><message /></el-icon>我的作业
            </el-menu-item>
            <el-menu-item index="2">
                <el-icon><icon-menu /></el-icon>课程班级
            </el-menu-item>
          </el-menu>
        </el-scrollbar>
      </el-aside>
  
      <el-container>
        <el-header style="text-align: right; font-size: 12px">
          <div class="toolbar">
            <el-dropdown>
              <el-icon style="margin-right: 8px; margin-top: 1px"
                ><setting
              /></el-icon>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item>View</el-dropdown-item>
                  <el-dropdown-item>Add</el-dropdown-item>
                  <el-dropdown-item>Delete</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
            <span>Tom</span>
          </div>
        </el-header>
  
        <el-main>
          <el-scrollbar>

            <el-table :data="tableData" v-if="Istrue">
              <el-table-column prop="title" label="作业" width="180" />
              <el-table-column prop="teacher" label="老师" width="120" />
              <el-table-column prop="data" label="截止时间" />
            </el-table>
            <course v-if="!Istrue"> </course>
          </el-scrollbar>
        </el-main>
      </el-container>
    </el-container>
  </template>
  
  <script lang="ts" setup>
  import { ref } from 'vue'
  import { Menu as IconMenu, Message, Setting } from '@element-plus/icons-vue'
  import course from '@/components/homework/course.vue'
import { el } from 'element-plus/es/locale'

  const Istrue=ref(true)
  const item = {
    title: 'Spark 系统与开发作业3',
    teacher: 'Tom',
    data: 'No. 189, Grove St, Los Angeles',
  }
  const tableData = ref(Array.from({ length: 20 }).fill(item))

  const handleSelect=(key:any,keypath:any)=>{
       if(key==1){
        Istrue.value=true
       }else{
        Istrue.value=false
       }
  }
  </script>
  
  <style scoped>
  .layout-container-demo .el-header {
    position: relative;
    /* background-color: var(--el-color-primary-light-7); */
    color: var(--el-text-color-primary);
  }
  .layout-container-demo .el-aside {
    color: var(--el-text-color-primary);
    /* background: var(--el-color-primary-light-8); */
  }
  .layout-container-demo .el-menu {
    border-right: none;
  }
  .layout-container-demo .el-main {
    padding: 0;
  }
  .layout-container-demo .toolbar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    right: 20px;
  }
  </style>
  